package com.credithc.customers.dataservice.mapper.JHZF;

import com.credithc.customers.dataservice.po.JhzfBankPo;
import com.credithc.customers.dataservice.po.SystemUserPo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface JhzfMapper {
    @Select("SELECT merchant_no userId ,create_time creatTime ,update_time updateTime ,bank_acc_no  bankCard from merchant_bank_account where merchant_no = #{userId};")
    JhzfBankPo getByUserId(String userId);
    @Select("select MAX(id)  from merchant_bank_account")
    Long queryUserMaxId();

    @Select(" select merchant_bank_account.bank_acc_no customerId ,merchant_user.customer_id customerNo ,merchant_bank_account.id incrementId,merchant_bank_account.merchant_no\n " +
            " userId ,merchant_bank_account.create_time creatTime ,merchant_bank_account.update_time updateTime \n" +
            " from merchant_bank_account LEFT JOIN merchant_user on merchant_bank_account.merchant_no = merchant_user.merchant_no\n " +
            " where merchant_bank_account.id < #{toString} and merchant_bank_account.id >=  #{toString} - 1000  ORDER BY merchant_bank_account.id desc")
    List<SystemUserPo> queryHyrUser(String toString);
    @Select("SELECT customer_id from merchant_user where merchant_no = #{s}")
    String getCustomerNo(String s);
}
